package com.my.test.thread.join;

public class TestJoin {

    public static void main(String[] args) throws InterruptedException {

        Thread t1 = new Thread (()->{//lambda表达式

            System.out.println("t1");
        });

        Thread t2 = new Thread (()->{//lambda表达式
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("t2");
        });


        // 先执start再执行join
        t2.start();
        t2.join();
        // 阻塞t1和main线程
        t1.start();
        System.out.println("main");
    }
}
